<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Settle extends Model
{
	protected $table='settle';
	protected $guarded=[];
	public function lists($where){
		$data=$this->where(function ($query) use($where){
			$query->where(['company_id'=>$where['company_id']]);

			if($where['period'] !=null){
				$query->where(['period'=>$where['period']]);
			}
			if($where['start_time'] !=null){
				$query->where('created_at','>',$where['start_time']);
			}
			if($where['start_time'] !=null){
				$query->where('created_at','<',$where['end_time']);
			}
			if($where['statu'] !=null){
				$query->where('statu','=',$where['statu']);
			}
			if($where['status'] !=null){
				$query->where('status','=',$where['status']);
			}
		})->simplePaginate(config('app.config'));

		return $data;
	}
}
